using AutoMapper;
using Pay.DTO;
using Pay.Data;
using Pay.IService;

namespace Pay.Service.AutoMapper
{
    public class ProductActivityTimeBuyMapper : IStartupDto
    {
        private IMapperConfigurationExpression _cfg;
        public ProductActivityTimeBuyMapper(IMapperConfigurationExpression cfg)
        {
            _cfg = cfg;
        }
        public void Execute()
        {
            Create();
        }
        protected virtual void Create()
        {
            _cfg.CreateMap<ProductActivityTimeBuy, product_activity_time_buy_dto>()
                .ForMember(dest => dest.product_activity_id, src => src.MapFrom(c => c.ProductActivityId))
                .ForMember(dest => dest.cost_price, src => src.MapFrom(c => c.CostPrice))
                .ForMember(dest => dest.min_buy_mum, src => src.MapFrom(c => c.MinBuyNum))
                .ForMember(dest => dest.max_buy_num, src => src.MapFrom(c => c.MaxBuyNum))
                .ForMember(dest => dest.horse_power, src => src.MapFrom(c => c.HorsePower))
                .ForMember(dest => dest.horse_power_effective, src => src.MapFrom(c => c.HorsePowerEffective))
                .ForMember(dest => dest.product_activity, src => src.MapFrom(c => c.ProductActivity));


            _cfg.CreateMap<product_activity_time_buy_dto, ProductActivityTimeBuy>()
                .ForMember(dest => dest.ProductActivityId, src => src.MapFrom(c => c.product_activity_id))
                .ForMember(dest => dest.CostPrice, src => src.MapFrom(c => c.cost_price))
                .ForMember(dest => dest.MinBuyNum, src => src.MapFrom(c => c.min_buy_mum))
                .ForMember(dest => dest.MaxBuyNum, src => src.MapFrom(c => c.max_buy_num))
                .ForMember(dest => dest.HorsePower, src => src.MapFrom(c => c.horse_power))
                .ForMember(dest => dest.HorsePowerEffective, src => src.MapFrom(c => c.horse_power_effective))
                .ForMember(dest => dest.ProductActivity, src => src.MapFrom(c => c.product_activity));


        }
    }
}
